<template>
  <div>
    <template>
      <div class="wrapper">
        <!-- 图片轮播图区域 -->
        <swiper ref="swiperRef" :options="swiperOptions" v-if="showSwiperList">
          <swiper-slide  v-for="item in swiperList" :key="item.id">
            <img :src="item.url" />
          </swiper-slide>
          <div class="swiper-pagination" slot="pagination"></div>
        </swiper>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  props: {
    swiperList: Array
  },
  data () {
    return {
      swiperOptions: {
        pagination: {
          el: '.swiper-pagination'
        },
        loop: true
      }
    }
  },
  computed: {
    showSwiperList () {
      return this.swiperList.length
    }
  }
}
</script>

<style lang="stylus" scoped>
.wrapper >>> .swiper-pagination-bullet {
  background-color: tomato;
}
.wrapper {
  width: 100%;
  height: 30.5vw;
  background-color: #eee;
}
.swiper-slide img{
  width: 100%;
}
</style>
